import request from '@/utils/request'

// 查询券码信息列表
export function listCoupon(query) {
  return request({
    url: '/business/coupon/list',
    method: 'get',
    params: query
  })
}

// 查询券码信息详细
export function getCoupon(couponId) {
  return request({
    url: '/business/coupon/' + couponId,
    method: 'get'
  })
}

// 新增券码信息
export function addCoupon(data) {
  return request({
    url: '/business/coupon',
    method: 'post',
    data: data
  })
}

// 修改券码信息
export function updateCoupon(data) {
  return request({
    url: '/business/coupon',
    method: 'put',
    data: data
  })
}

// 删除券码信息
export function delCoupon(couponId) {
  return request({
    url: '/business/coupon/' + couponId,
    method: 'delete'
  })
}



export function handleStatusChange(couponId, status) {
    const data = {
        couponId,
        status
    }
    return request({
        url: '/business/coupon/changeStatus',
        method: 'put',
        data: data
    })
}
export function handleAuditChange(couponId, audit) {
    const data = {
        couponId,
        audit
    }
    return request({
        url: '/business/coupon/audit',
        method: 'put',
        data: data
    })
}
